<#import '/ftlLibrary/properteisVariable.ftl' as pv/>
<style>
    .bootbox-close-button {
        width: 19px;
        height: 19px;
        border: none;
        cursor: pointer;
        -webkit-appearance: none;
        float: right;
        top: 4px;
        left: -5px;
        position: relative;
        background: #E9F5FF url("assets/img/nav-img/icon_close.png") no-repeat 0 0;
    }

    .returnClassRecordEdit .modal-dialog {
        width: 80% !important;
    }

    .modal-content {
        width: 100%;
    }

    input, select, .form-control {
        height: 30px;
    }

    .myDialogDetail label {
        margin-bottom: 0px !important;
    }

    .detailDialogStyle {
        line-height: 30px;
        margin-bottom: 15px;
    }

    .myDialogDetail1 .modal-body {
        padding-bottom: 0px !important;
        border-bottom-right-radius: 5px !important;
        border-bottom-left-radius: 5px !important;
    }
    .btn-group label{
        margin:0px!important;
    }
</style>
<div class="row" style="margin-left: 0px!important;">
    <div class="col-lg-12 col-sm-12 col-xs-12">
        <form class="editForm" action="${saveUrl}" method="post" responseType="JSON" role="form"
              id="editForm_${serializeNum}"
              data-bv-submitButtons="#editFormSubmitBtn_${serializeNum}"
              data-bv-message="This value is not valid"
              data-bv-feedbackicons-valid="glyphicon glyphicon-ok"
              data-bv-feedbackicons-invalid="glyphicon glyphicon-remove"
              data-bv-feedbackicons-validating="glyphicon glyphicon-refresh">
            <input type="hidden" name="memberPackageId"  class="memberPackageId" value="${memberPackageId}">
            <input type="hidden" name="memberId"  class="memberId" value="${memberId}">
            <input type="radio" name="attendClassId" value="${attendClassId}">
            <#if (true && editModel=='add')||(true && editModel=='edit')>
                <div class="col-xm-12 col-sm-6 col-lg-12 margin-top-20 margin-bottom-20">
                    <div class="form-group text-align-center" style="margin-bottom: 15px!important;">
                        <input type="radio" name="zxc" style="margin-right: 5px;opacity: 1;position: static;" class="checkedFalse" checked>
                        <label style="margin-right: 10px">退单节班</label>
                        <input type="radio" name="zxc" style="margin-right: 5px;opacity: 1;position: static;" class="checkedTrue">
                        <label style="margin-right: 10px">退全部全部班级</label>
                    </div>
                    <div class="btn-toolbar text-align-center" role="toolbar" >
                        <div class="widget flat radius-bordered" style="margin-top: 0;box-shadow:0px 0px 10px rgba(122,161,184,0.3);">
                            <div class="widget-body no-padding">
                                <div class="table-scrollable" style="border: none;" id="tableScrollable">
                                    <!-- 数据表列信息列表 -->
                                    <table class="table table-hover dataTable newtable">
                                        <thead>
                                        <tr>
                                            <th title="选择" class="checkboxColumnTh">
                                                <!--<div class="checkbox">-->
                                                    <!--<label>-->
                                                        <!--<input type="checkbox" class="chkAll" onclick="chekAll()">-->
                                                        <!--<span class="text"></span>-->
                                                    <!--</label>-->
                                                <!--</div>-->
                                            </th>
                                            <th title="课程周次">课程周次</th>
                                            <th title="上课日期">上课日期</th>
                                            <th title="上课时间">上课时间</th>
                                            <th title="周几上课">周几上课</th>
                                            <th title="授课老师">授课老师</th>
                                            <th title="上课教室">上课教室</th>
                                            <th title="耗课时数">耗课时数</th>
                                        </tr>
                                        </thead>
                                        <tbody>
                                        <#list mapList as data>
                                            <tr>
                                                <td class="checkboxColumnTd">
                                                    <div class="checkbox btn-group">
                                                        <label>
                                                            <input type="checkbox" class="chk" name="clId" value="${data.id}">
                                                            <span class="text"></span>
                                                        </label>
                                                    </div>
                                                </td>
                                                <td>${data.classIndexTime}</td>
                                                <td>${data.classTime}</td>
                                                <td>${data.startTime} - ${data.endTime}</td>
                                                <td><@dictionary groupCode="weekDay" dictionaryCode="${data.weekDay}" ;weekDay>${weekDay.value}</@dictionary></td>
                                                <td>${data.teacherName}</td>
                                                <td>${data.className}</td>
                                                <td>${data.expendClassHour}</td>
                                            </tr>
                                        </#list>
                                        </tbody>
                                    </table>
                                </div>
                                ${pagingBar}
                            </div>
                        </div>
                    </div>

                </div>
            </#if>

            <div class="col-sm-12 text-align-center">
                <button style="width: 80px;margin-right: 20px" type="submit" onclick="showDialogAttendChangeClass(this)" class="btn btn-blue" id="editFormSubmitBtn_${serializeNum}">保存
                </button>
                <input style="width: 80px;" type="button" class="btn btn-blue" data-dismiss="modal" value="返回" />

            </div>
        </form>
    </div>
</div>
<script src="assets/js/validation/bootstrapValidator_init.js"></script>
<script>
    $(".selectpicker_${serializeNum}").select2();

    $(".checkboxs").change(function () {
        if ($(this).is(':checked')) {
            $(".btn-group input").prop("checked", true);
        } else {
            $(".btn-group input").prop("checked", false);
        }
    })

    $(".checkedFalse").change(function () {
        $(".btn-group input").prop("checked", false);
    })

    $(".checkedTrue").change(function () {
        $(".btn-group input").prop("checked", true);
    })


    function showDialogAttendChangeClass() {
        var memberPackageId = $(".memberPackageId").val();
        var memberId = $(".memberId").val();
        var allCheckVlaues = new Array();
        $("[name='clId']:checked").map(function (index, chk) {
            var value = chk.value;
            allCheckVlaues.push(value);
        });
        var allCheckVlauesStr = allCheckVlaues.join(",");
        ajaxRequest("tssMemberReturnClassRecordController/saveOrUpdate.do", {
            targetDataId: allCheckVlauesStr,
            memberPackageId: memberPackageId,
            memberId:memberId
        }, function (result) {
            if(result.resCode == 200){
                bootbox.hideAll();
                logger.info(result.resMsg, true);
                toView('tssMemberPackageController/tssMemberPackageList.do?type=1',true,'POST',{pageSize:10})
            } else {
                logger.error(result.resMsg);
            }
        }, function () {
            ajaxError("加载页面失败!")
        }, "post", "json")
    }
</script>